#include<bits/stdc++.h>
using namespace std;
long long n,a[100010],ans=1,c[100010],b[100010],sum=0,h=1,p=0;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b+1,b+n+1);
    sum=b[1];
    for(int i=2;i<=n;i++){
        if(b[i]==sum){
            ans++;
        }else{
            sum=b[i];
            c[h]=ans;
            h++;
            ans=1;
        }
        c[h]=ans;
    }
    for(int i=1;i<h;i++){
       if(c[i]<=c[i+1]){
            p=p+c[i];
       }else
       if(c[i]>c[i+1]){
            p=p+c[i+1];
       }
    }
    p=n-p;
    cout<<p<<endl;
    return 0;
}
